<template>
	<div>
		<el-dialog
			title="修改"
			:visible.sync="compileDialogTableVisible"
			:close-on-click-modal="false"
			:show-close="false"
			:close-on-press-escape="false"
		>
			<el-form ref="compileContent" :model="compileContent" label-width="100px">
				<el-form-item label="名称：">
					<el-input v-model="compileContent.a"></el-input>
				</el-form-item>
				<el-form-item label="API代码：">
					<el-input v-model="compileContent.b"></el-input>
				</el-form-item>
				<el-form-item label="ApiKey">
					<el-input v-model="compileContent.c"></el-input>
				</el-form-item>
				<el-form-item label="是否启用：">
					<el-switch
						v-model="compileContent.d"
						active-value="0"
						inactive-value="1"
					></el-switch>
				</el-form-item>
				<el-form-item label="名称：">
					<!-- v-model="compileContent.d" -->
					<el-date-picker
						v-model="compileContent.e"
						type="date"
						placeholder="选择日期"
						value-format="yyyy-MM-dd"
						@change="triggerDate"
					>
					</el-date-picker>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="confirm('compileContent')"
					>确 定
				</el-button>
				<el-button @click="cancel('compileContent')">取 消</el-button>
			</div>
		</el-dialog>
	</div>
</template>

<script>
export default {
	props: {
		compileDialogTableVisible: {
			type: Boolean,
			default: false,
		},
		compileRow: {
			type: Object,
			default: () => {
				return {}
			},
		},
		// abc: {
		// 	type: String,
		// 	default: () => {
		// 		return ''
		// 	},
		// },
	},
	data() {
		return {
			// abc: '2021-10-11',
		}
	},
	computed: {
		compileContent() {
			return this.compileRow
		},
		// asd: {
		// 	get: function () {
		// 		return this.abc
		// 	},
		// 	set: function () {
		// 		return this.abc
		// 	},
		// },
	},
	methods: {
		triggerDate() {},
		confirm(formName) {
			this.$refs[formName].validate(valid => {
				if (valid) {
					console.log(this.compileContent, '修改后的内容')
					// let update = {
					// 	id: this.compileContent.id,
					// 	paramName: this.compileContent.paramName,
					// 	datasql: this.compileContent.dataSql,
					// }
					// formulaUpdate(update).then(({ data }) => {
					// 	console.log(data)
					// 	if (data.head.code == 200) {
					// 		this.$message({
					// 			message: '保存成功',
					// 			type: 'success',
					// 		})
					// 	}
					// })
					let dialogValue = {
						verdict: false,
						typeValue: 1,
					}
					this.$emit('compileClick', dialogValue)
				} else {
					return false
				}
			})
		},
		// 取消
		cancel() {
			let dialogValue = {
				verdict: false,
				typeValue: 0,
			}
			this.$emit('compileClick', dialogValue)
		},
	},
}
</script>

<style></style>
